using System.Collections.Generic;
using System.Text;
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using System.IO;
using System.Xml;

namespace Ramparts
{
    
    // GameComponent is the high level object that all game objects should use
    // defines a basic set of everything needed to create an asset in the game
    public class GameComponent 
    {
    
    public Texture2D texture;
	public Vector2 position = Vector2.Zero;
	public Rectangle? sourceRect = null;
	public Color color = Color.White;
	public float rotation = 0f;
	public Vector2 origin = Vector2.Zero;
	public float scale = 1f;
	public SpriteEffects effects = SpriteEffects.None;
	public float layerDepth = 0;
    public bool alive = false;
    public SceneManager sceneManager;
    public bool useCamera = false;
    public float bearing;
    public float speed;
    public string name;

    
        // Stat Type Stuff
    protected int totalHitPoints;
    protected int currentHitPoints;

    public GameComponent()
    {

    }

    // Create a GameObject with the given information
    public GameComponent(String textureName, Vector2 position, SceneManager inSceneManager)
    {
        this.sceneManager = inSceneManager;
        this.position = position;
        texture = sceneManager.rampart.content.Load<Texture2D>(textureName);
     }

   

    

    // Draw the texture at it's current position
    virtual public void Draw()
    {

        if (sceneManager == null)
            return;

        
        if (texture == null)
            return ;

        sceneManager.rampart.spriteBatch.Draw(texture, position, sourceRect, Color.White);
        
    }

    virtual public void Update(GameTime gameTime)
    {
        // Do NOthing;
        Console.WriteLine("Updating " + name);
    }


    // Draw the texture at a specific location
    public void Draw(int x, int y)
    {
        if (texture == null)
            return;

        sceneManager.rampart.spriteBatch.Draw(
            texture,
            new Vector2(x,y),
            sourceRect,
            color,
            rotation,
            origin,
            scale,
            effects,
            layerDepth);
    }

    }
}

